package com.google.code.jskills.dal.entities;

// Generated 25.06.2013 17:52:09 by Hibernate Tools 3.6.0

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * RolePermissionEntity generated by hbm2java
 */
@Entity
@Table(name = "ROLE_PERMISSION", schema = "PUBLIC", catalog = "PUBLIC", uniqueConstraints = @UniqueConstraint(columnNames = {
		"ROLE_ID", "PERMISSION_ID" }))
public class RolePermissionEntity implements java.io.Serializable {

	private RolePermissionEntityId id;
	private PermissionEntity permissionEntity;
	private RoleEntity roleEntity;

	public RolePermissionEntity() {
	}

	public RolePermissionEntity(RolePermissionEntityId id,
			PermissionEntity permissionEntity, RoleEntity roleEntity) {
		this.id = id;
		this.permissionEntity = permissionEntity;
		this.roleEntity = roleEntity;
	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "roleId", column = @Column(name = "ROLE_ID", nullable = false)),
			@AttributeOverride(name = "permissionId", column = @Column(name = "PERMISSION_ID", nullable = false)) })
	public RolePermissionEntityId getId() {
		return this.id;
	}

	public void setId(RolePermissionEntityId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PERMISSION_ID", nullable = false, insertable = false, updatable = false)
	public PermissionEntity getPermissionEntity() {
		return this.permissionEntity;
	}

	public void setPermissionEntity(PermissionEntity permissionEntity) {
		this.permissionEntity = permissionEntity;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ROLE_ID", nullable = false, insertable = false, updatable = false)
	public RoleEntity getRoleEntity() {
		return this.roleEntity;
	}

	public void setRoleEntity(RoleEntity roleEntity) {
		this.roleEntity = roleEntity;
	}

}
